import {RENQI_JIA, RENQI_JIAN} from '../constants';
let init = 100;

export default function renqiReducer(state=init, action)  {
    //根据 action 的操作类型, 对 state 进行操作
    switch(action.type){
        case RENQI_JIA:
            return state + action.data;
        case RENQI_JIAN:
            return state - action.data;
        //这个默认操作 『必须』要加, 因为内部要对 state 进行初始化  
        default:
            return state;
    }
}